<?php
function getSalt(){
  $salt = '';
  $length = mt_rand(4,8);
  for($i=0;$i<$length;$i++){
      $tmp = rand(1,3);
      switch($tmp){
          case 1 :
              $salt.=sprintf('%c',rand(48,57));
              break;
          case 2 :
              $salt.=sprintf('%c',rand(97,122));
              break;
          case 3 :
              $salt .=sprintf('%c',rand(65,90));
              break;
      }
  }
  return $salt;
}
function getTree($arr,$i=0){
  static $a = array();
  foreach($arr as $v){
    if($v['cate_pid']==$i){
      $a[] = $v;
      getTree($arr,$v['cate_id']);
    }
  }
  return $a;
}
?>
